package uk.co.richardwkirk.funnels;


public class FunnelSettings extends Settings {

	public int NUMBER = 2;
	public int LENGTH = 40;
	public double SPACE_SIZE = 0.5;
	public int BUFFER_SIZE = 10;
	
	public boolean SHARED_FUNNELS = true;
	
	public double FLOW_RATE_METRES_PER_SECOND = 2.0;
	
	public long EXIT_INTERVAL = 1000;

	protected long funnelStepInterval() {
		int steps = (int)(LENGTH / SPACE_SIZE);
		double timeToFunnel = LENGTH / FLOW_RATE_METRES_PER_SECOND;
		long millisecondsToFunnel = (long)(timeToFunnel * 1000);
		long funnelStepInterval = millisecondsToFunnel / steps;
		return funnelStepInterval;
	}
	
	public boolean isFunnelShiftTime(long currentTime) {
		return intervalTest(currentTime, funnelStepInterval());
	}

	public boolean isExitTime(long currentTime) {
		return intervalTest(currentTime, EXIT_INTERVAL);
	}
		
	
}
